#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int ans = 0;
	int t = 0;
	while (n) {
		t = n % 16;
		if (t == 0 || t == 6 || t == 9 || t == 13) {
			ans += 1;
		}
		else if (t == 8 || t == 11) {
			ans += 2;
		}
		n /= 16;
	}
	cout << ans << endl;
	return 0;
}